package cdms.db;

import java.util.List;

import cdms.domain.Manager;
import cdms.web.PaginationSupport;

/**
 * Manager resource interface
 * 
 * @author chenjing
 * @version v1.0
 */
public interface ManagerRepository {

	/**
	 * get the number of managers
	 * 
	 * @return
	 */
	long count();

	/**
	 * get the number of managers by search userName
	 * 
	 * @param search
	 * @return
	 */
	long countByUserName(String search);

	/**
	 * get the number of managers by search fullName
	 * 
	 * @param search
	 * @return
	 */
	long countByFullName(String search);

	/**
	 * add a new manager
	 * 
	 * @param manager
	 * @return
	 */
	Manager save(Manager manager);

	/**
	 * update information of the manager
	 * 
	 * @param manager
	 * @return
	 */
	Manager update(Manager manager);

	/**
	 * delete a manager by id
	 * 
	 * @param id
	 * @return
	 */
	boolean delete(Long id);

	/**
	 * search a manager by id
	 * 
	 * @param id
	 * @return
	 */
	Manager findOne(Long id);

	/**
	 * search a manager by userName
	 * 
	 * @param userName
	 * @return
	 */
	Manager findByUserName(String userName);

	/**
	 * search a manager by userName and password
	 * 
	 * @param userName
	 * @param password
	 * @return
	 */
	Manager findByUserName(String userName, String password);

	/**
	 * get the list of managers
	 * 
	 * @return
	 */
	List<Manager> findAll();

	/**
	 * get managers by pageNo and pageSize
	 * 
	 * @param pageNo
	 * @param pageSize
	 * @return
	 */
	PaginationSupport<Manager> findPage(int pageNo, int pageSize);

	/**
	 * get managers by pageNo, pageSize and search userName
	 * 
	 * @param pageNo
	 * @param pageSize
	 * @param search
	 * @return
	 */
	PaginationSupport<Manager> searchByUserName(int pageNo, int pageSize, String search);

	/**
	 * get managers by pageNo, pageSize and search fullName
	 * 
	 * @param pageNo
	 * @param pageSize
	 * @param search
	 * @return
	 */
	PaginationSupport<Manager> searchByFullName(int pageNo, int pageSize, String search);

}
